package com.os.content;

import com.os.utils.ConfigUtils;

/**
 * 内存信息常量
 */
public class MemoryContent {
    /**
     * 内存块大小
     */
    public static int FRAME_SIZE;

    /**
     * 物理内存大小
     */
    public static int PHYSICAL_MEMORY;

    /**
     * 一个段最多多少页
     */
    public static int PAGE_MAX_NUMBER;


    /**
     * 分段符号
     */
    public static final String SEGMENT_SPLIT = "$segment$";

    public static int LINE_LENGTH;

    static {
        reload();
    }

    // 加载配置信息
    public static void reload() {
        ConfigUtils.refresh();
        FRAME_SIZE = (int) ConfigUtils.get(ConfigUtils.FRAME_SIZE);
        PHYSICAL_MEMORY = (int) ConfigUtils.get(ConfigUtils.PHYSICAL_MEMORY);
        PAGE_MAX_NUMBER = (int) (PHYSICAL_MEMORY * 0.5);
        LINE_LENGTH = (int) ConfigUtils.get(ConfigUtils.LINE_LENGTH);
    }

}
